<template>
    <el-breadcrumb separator="/" class="Breadcrumb">
    <el-breadcrumb-item :key="index"  v-for="(item, index) in list">
      <span  v-if="isLast(index)">{{ showName(item) }}</span>
       <router-link :to="item.path" class="active" v-else>{{ showName(item) }}</router-link>
    </el-breadcrumb-item>
  </el-breadcrumb>
</template>
<script>
export default {
	name: 'breadcrumb',
	props: ["list"],
	created(){
      
	},
	methods: {
		isLast (index) {
			return index === this.list.length - 1
		},
		showName (item) {
			if (item.meta && item.meta.label) {
				item = item.meta && item.meta.label
			}
			if (item.name) {
				item = item.name
			}
			return item
		}
	}
}
</script>
<style>
  .el-breadcrumb{
    width: 94%;
    margin: 0 auto;
    margin-top: 20px;
    margin-bottom: 20px;
  }
  .active{
    
  }
</style>